@inject('appRepository', 'App\Repositories\AppRepository')
@php
    $Recommend = $appRepository->getRecommendCourse()
@endphp
@extends('layouts.app',['navShow'=>true])
@section('title','全部课程')
@section('content')
    <div class="container mt-2">
        <div class="row">
        <div class="col-xl-9">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/">首页</a></li>
                    <li class="breadcrumb-item active" aria-current="page">全部课程</li>
                </ol>
            </nav>
            <div class=" select-box">
                <div class="mb-3">
                    <a class="ml-2 point {{$category==''?'active':''}}"
                       href="{{url('course/list?'.http_build_query(['category'=>'','status'=>$status,'type'=>$type]))}}">全部课程</a>
                    @foreach($appRepository->getCourseCategory() as $item)
                        <a class="point {{$category==$item->id?'active':''}}"
                           href="{{ url('course/list?' . http_build_query(['category' => $item->id,'status'=>$status,'type'=>$type ])) }}">{{ $item->name}}</a>
                    @endforeach
                </div>
                <div class="check-list-box d-flex align-items-center">
                    {{--<a class="check-list-item {{$status==''?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>'','type'=>$type ])) }}"><span> 全部</span></a>--}}
                    {{--<a class="check-list-item {{$status=='1'?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>1,'type'=>$type ])) }}"><span>已付费</span></a>--}}
                    {{--<a class="check-list-item {{$status=='2'?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>2,'type'=>$type ])) }}"><span>未付费</span></a>--}}
                    {{--<div class="fe-line"></div>--}}
                    <a class="check-list-item {{$type==''?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>$status,'type'=>''])) }}"><span>全部</span></a>
                    <a class="check-list-item {{$type=='ready'?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>$status,'type'=>'ready'])) }}"><span>未开始</span></a>
                    <a class="check-list-item {{$type=='live'?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>$status,'type'=>'live'])) }}"><span>直播中</span></a>
                    <a class="check-list-item {{$type=='end'?'active':''}}" href="{{ url('course/list?' . http_build_query(['category' => $category,'status'=>$status,'type'=>'end'])) }}"><span>看回放</span></a>
                    {{--<div class="fe-line"></div>--}}
                </div>
            </div>
            <div class="row course-box my-4">
                @foreach($model as $item)
                    <div class="col-4 mb-3">
                        <a href="/course/{{$item->id}}/course-detail">
                            <div class="col p-0">
                                <img class="img-fluid" src="{{$item->image_path}}" alt="">
                                <div class="media__body">
                                    <img src="{{asset('/img/播放.png')}}" alt="">
                                </div>
                            </div>
                        </a>
                        <div class="d-flex course-body justify-content-between m-2">
                            <a href="/course/{{$item->id}}/course-detail" class=""> {{$item->name}}</a>
                        </div>
                    </div>
                @endforeach
            </div>
            {{ $model->links('layouts.page') }}
        </div>
        <div class="col-xl-3 course-box">
            <div class="remen-title mt-3">
                <p>热门课程</p>
            </div>
            @foreach($Recommend as $item)
                <div class="mb-3 ">
                    <a href="/course/{{$item->id}}/course-detail">
                        <div class="col p-0">
                            <img class="img-fluid" src="{{$item->image_path}}" alt="">
                            <div class="media__body">
                                <img src="{{asset('/img/播放.png')}}" alt="">
                            </div>
                        </div>
                    </a>
                    <div class="d-flex course-body justify-content-between m-2">
                        <a href="/course/{{$item->id}}/course-detail" class=""> {{$item->name}}</a>
                    </div>
                </div>
            @endforeach
        </div>
        </div>
    </div>
@endsection